#include "mesh.h"

#include "readFile.h"
#include "s2dMesh.h"
// #include <boost/filesystem.hpp>

#include <bits/stdc++.h>
#include <sys/stat.h>
#include <sys/types.h>

using namespace std;

string mesh::meshType;
int mesh::writePrecision;
int mesh::getMeshPara(vector<fileData> meshPara)
{
    cout<<"Get mesh parameter."<<endl;
    for(int k=0;k<meshPara.size();k++){
        if(meshPara[k].type=="meshType"){
            meshType=meshPara[k].value;
            cout<<"\tMesh type:"<<meshType<<endl;
        }
        if(meshPara[k].type=="writePrecision"){
            writePrecision=stoi(meshPara[k].value);
        }
    }
    if(meshType=="structured2d"){
        s2dMesh::getS2dMeshPara(meshPara);
    }
    cout<<"Done."<<endl<<endl;
    return 0;
}

int basic::dshMkdir(string path)
{
    mkdir(path.c_str(),S_IRWXU);
    return 0;
}